﻿using System.Collections.Generic;

namespace CH.FourBoards.LagerWalti.Persistence.Setup.Creation
{
	internal class RecreateIfObsolete : DatabaseInitializer
	{
		public RecreateIfObsolete(IList<IDataGenerator> generators)
			: base(generators)
		{
		}

		protected override bool RecreateDatabase(DataContext context)
		{
			if (!DbExists(context)) {
				return true;
			}
			if (!IsCompatible(context)) {
				return true;
			}
			if (IsEmpty(context)) {
				return true;
			}
			if (HasObsoleteData(context)) {
				return true;
			}
			return false;
		}

	}
}
